<?php
/**
 * menu.php
 * @author ranuandra
 *
 * 9 Agu 2011 08:54:56
 *
 * 
 */
$admin = false;
//print_r(Auth_ORM::instance()->get_user()->roles);
//echo (Auth_ORM::instance()->get_user()->roles->name);
$roles = Auth_ORM::instance()->get_user()->roles->find_all();
foreach($roles as $role)
{
	if($role->name == "admin")
	{
		$admin = true;
	}
}
?>
		<ul class="sf-menu">
			<li class="current">
				<a class="topmenu" href="#">Report</a>
				<ul>

					<li>
						<a class="topmenu" href="<?php echo URL::base()?>report">Search By Types</a>
					</li>
					<li>
						<a class="topmenu" href="<?php echo URL::base()?>report/customer">Search By Customers</a>
					</li>
					<li>
						<a class="topmenu" href="<?php echo URL::base()?>customer">Customer</a>
					</li>
				</ul>
			</li>
<?php 
if($admin==true)
{
?>
			<li>
				<a href="#">Admin</a>
				<ul>
					<li>
						<a class="topmenu" href="<?php echo URL::base()?>role">Roles</a>
					</li>
					<li>
						<a class="topmenu" href="<?php echo URL::base()?>user">User</a>
					</li>
					<li>
						<a class="topmenu" href="<?php echo URL::base()?>menu">Menu</a>
					</li>
				</ul>
			</li>
			<li>
				<a href="#">Master</a>
				<ul>
					<li>
						<a class="topmenu" href="<?php echo URL::base()?>upload">Upload</a>
					</li>
					<li>
						<a class="topmenu" href="<?php echo URL::base()?>customer">Customer</a>
					</li>
				</ul>
			</li>
<?php 
}
?>
			<li>
				<a class="topmenu" href="<?php echo URL::base()?>home/logout">Logout</a>
			</li>	
		</ul>